//using MultiAgentsShared;
//using System.Diagnostics;
//using System.IO.Pipes;

//public class HumanComService : MonoBehavior
//{
//    //RequestId, requestDetail
//    //private readonly Queue<string> _requestQueue = new();

//    public event Action<string> OnChatResponse;
//    private NamedPipeServerStream _pipeServer;

//    // Initialize and start listening for human input
//    public override void Start()
//    {
//        InitializeHumanInputListener();
//    }

//    //public void RequestChat(string chatMessage)
//    //{
//    //    _requestQueue.Enqueue(chatMessage);
//    //}

//    private void InitializeHumanInputListener()
//    {
//        // Start the separate input console application only once
//        Process.Start(new ProcessStartInfo
//        {
//            FileName = "..\\..\\..\\..\\HumanInputConsole\\bin\\Debug\\net8.0\\HumanInputConsole.exe", // Ensure the path is correct
//            UseShellExecute = true
//        });

//        // Create and start the named pipe server in a separate task to avoid blocking the main thread
//        Task.Run(async () =>
//        {
//            _pipeServer = new NamedPipeServerStream("HumanInputPipe", PipeDirection.In);
//            await _pipeServer.WaitForConnectionAsync();

//            using (var sr = new StreamReader(_pipeServer))
//            {
//                while (true) // Continuously listen for input
//                {
//                    string userInput = await sr.ReadLineAsync();
//                    if (userInput == null) break; // Stop if the pipe is closed

//                    if (userInput == "")
//                    {
//                        userInput = "[PASS]";
//                    }

//                    OnChatResponse?.Invoke(userInput);
//                }
//            }
//        });
//    }



//    public override void OnDestroy()
//    {
//        _pipeServer?.Dispose();
//    }
//}